import request from '@/utils/request'

export async function querySupplierDetail (id) {
  const row = await request.post('/admin/supplier/detail', { id })
  if (row) {
    if (row.province === row.city) {
      row.provinceCityArea = [row.city, row.area].join(' ')
    } else {
      row.provinceCityArea = [row.province, row.city, row.area].join(' ')
    }
  }
  return row
}

export function supplierAddManager (data) {
  return request.post('/admin/supplier/manager/add', data)
}

export function supplierModifyManager (data) {
  return request.post('/admin/supplier/manager/modify', data)
}

export function supplierListManager (data) {
  return request.post('/admin/supplier/manager/list', data)
}

/**
 * supplierId
 * id
 */
export function supplierDeleteManager (data) {
  return request.post('/admin/supplier/manager/delete', data)
}
